﻿import sys
import string
# Imports the monkeyrunner modules used by this program
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice

# Connects to the current device, returning a MonkeyDevice object
device = MonkeyRunner.waitForConnection()

print sys.argv
# 参数例如：monkeyrunner.bat drag.py 320 100 0 100 1
# 参数说明：前两个为起始坐标 x y，第三第四个参数为终点坐标 xy 第五个参数为 拖拽时间，单位秒
device.drag((string.atoi(sys.argv[1]), string.atoi(sys.argv[2])), (string.atoi(sys.argv[3]), string.atoi(sys.argv[4])), string.atoi(sys.argv[5]), 10)
